$(function() {
	admin.deliveryOrder.init();
});
Namespace('admin.deliveryOrder', {
	init : function() {
		easyui.util.initDatagrid('#datagrid', {
			onDblClickRow : function() {
				var row = $('#datagrid').datagrid('getSelected');
				admin.deliveryOrder.detail(row.id);
			}
		});
	},
	query : function() {
		if (!$('#query-form').form('validate'))
			return;
		var data = $('#query-form').form('jsonObject');
		$('#datagrid').datagrid('load', data);
	},
	detail:function(id) {
		if (id != null) {
			top.addTab(id,'配送单详情', contextPath+'/send/deliveryOrder/detail?id=' + id);
		}
	},
	export2Excel : function() {//导出excel
		var url = contextPath + '/send/deliveryOrder/export2Excel';
		var orderNo = $('#orderNo').val();
		var supplierId = $('#supplierId').val();
		var pickupStatus = $('#pickupStatus').val();
		var deliveryStatus = $('#deliveryStatus').val();
		var endAtStr = $("input[name=endAtStr]").val();//$('#endAtStr').val();
		var startAtStr = $("input[name=startAtStr]").val();//$('#startAtStr').val();
		var communityId = $('#communityId').val();
		
		$('#export_orderNo').val(orderNo);
		$('#export_supplierId').val(supplierId);
		$('#export_pickupStatus').val(pickupStatus);
		$('#export_deliveryStatus').val(deliveryStatus);
		$('#export_endAtStr').val(endAtStr);
		$('#export_startAtStr').val(startAtStr);
		$('#export_communityId').val(communityId);
		
		$('#export-form').attr("action",url);
		$('#export-form').submit();
	}
});